import {Pipe, PipeTransform} from '@angular/core';
import * as moment from 'moment';

/**
 * Generated class for the RelativeTime pipe.
 *
 * See https://angular.io/docs/ts/latest/guide/pipes.html for more info on
 * Angular Pipes.
 */
@Pipe({
  name: 'relativeTime',
})
export class RelativeTime implements PipeTransform {
  /**
   * Takes a value and makes it lowercase.
   */
  transform(value: string, ...args) {
    moment.locale('zh-cn');
    return moment(value).fromNow();
  }
}
